Ext.define('HIT.controller.SetBackUp', {
    extend: 'Ext.app.Controller',
    
    views  : ['SetBackUp'],
    onButtonClick: function(button, e, options) {
    	var p;
        var form=Ext.getCmp('tab-set-backup');        
        if (form == undefined) {
			return;
		}
        if(button.id=='set-backup-start'){
	           Share.AjaxRequest({
	      	      	url : ctx + '/setBackUp',
	      	    	params : {
	      		   },
	      	      callback : function(json) {      	    	        	    	  
	      			if(json.resultcode == '0') {
	      				Share.ShowMessage("I0006","备份");   				            		
	      			}else{
	      				Ext.Msg.alert(Share.T('错误'),json.resultcode);
	      			}   			
	      		 }    		
	      	  });
             
        }    		
    },
    getInfo :function(thisComp,e){    	
    	Share.AjaxRequest({
             url      : ctx + '/getBackUpInfo',
             params   : {
             },
             showMsg  : false,
             callback : function(json) {
                  Ext.getCmp('set-back-stime').setValue(json.data[0].stime);
                  Ext.getCmp('set-back-etime').setValue(json.data[0].etime);
                  Ext.getCmp('set-back-status').setValue(Share.T(json.data[0].status));
                  Ext.getCmp('set-back-download').setValue('<a href="'+json.data[0].download+'"target="blank">'+json.data[0].download+'</a>');                 
             }
         });
    },
    init: function(application) {
        this.control({
            "#headpanel button": {
                click: this.onButtonClick
           },
            "#tab-set-backup":{
            	activate: this.getInfo
            }
        });
    }
    });